import { createRef } from "react";
import { Outlet, Navigate } from "react-router-dom";
import { SuspenseComponent } from "@/utils/MyFun";

const user = {
  name: "用户管理",
  path: "/user",
  element: <Outlet />,
  nodeRef: createRef(null),
  isHidden: false,
  meta: {
    title: "用户管理",
    icon: "ph:user-list-bold",
    order: 4,
    // role: ['admin'],
    // requireAuth: true,
    keepAlive: true,
  },
  children: [
    {
      path: "/user",
      element: <Navigate to="/user/list" />,
      nodeRef: createRef(null),
      redirect: true,
    },
    {
      name: "用户列表",
      path: "list",
      element: SuspenseComponent("/user/list"),
      nodeRef: createRef(null),
      isHidden: false,
      meta: {
        title: "用户列表",
        icon: "mdi:account",
        keepAlive: true,
        order: 1,
      },
    },
    {
      name: "在线用户",
      path: "online",
      element: SuspenseComponent("/user/online"),
      nodeRef: createRef(null),
      isHidden: false,
      meta: {
        title: "在线用户",
        icon: "ic:outline-online-prediction",
        keepAlive: true,
        order: 2,
      },
    },
  ],
};

export default user;
